HTML = {};
HTML.generateUniqueId = function(d) {
    var b = new Date().getTime();
    var a = Math.ceil(Math.random() * 100);
    var c = b + "-" + a;
    return d + "-" + c
}
;
HTML.copyText = function(b) {
    if (navigator.clipboard) {
        navigator.clipboard.writeText(b)
    } else {
        var a = document.createElement("textarea");
        document.body.appendChild(a);
        a.style.position = "fixed";
        a.style.clip = "rect(0 0 0 0)";
        a.style.top = "10px";
        a.value = b;
        a.select();
        document.execCommand("copy", true);
        document.body.removeChild(a)
    }
}
;
HTML.swiper = function(c, h, e, d) {
    var b = $('<div class="swiper-container banner">         <div class="swiper-wrapper">          </div>          <div class="swiper-pagination"></div>     </div>');
    var g = '<div class="swiper-slide"><a href="javascript::;" data-model="{model}" data-href="{href}"><img src="{img}"></a></div>';
    var f = b.find(".swiper-wrapper");
    c.append(b);
    var a = HTML.generateUniqueId("banner");
    b.attr("id", a);
    Net.carouselList(h, function(s) {
        var o = s.data;
        var l = o.length;
        if (l == 0) {
            b.remove()
        }
        for (var p = 0; p < l; p++) {
            var k = o[p];
            var r = g.replace("{href}", k.url);
            r = r.replace("{model}", k.openModel);
            var m = $(r);
            var w = k.cover;
            m.find("img").attr("data-src", w);
            m.data("data", k);
            f.append(m);
            m.on("click", function() {
                var B = $(this);
                var y = B.find("a");
                var i = y.attr("data-model");
                var C = y.attr("data-href");
                var A = "_self";
                if (i == 1) {
                    A = "_blank"
                } else {
                    if (C.startsWith("http")) {
                        C = C
                    } else {
                        C = C + "&userId=" + App.getUser().id
                    }
                }
                if (C.startsWith("http") || C.indexOf("user/pay") != -1) {
                    if (C.indexOf("user/pay") != -1) {
                        App.redirect(C, {
                            deviceId: App.getUser().deviceId
                        })
                    }
                    if (window.self == window.top) {
                        var x = window.parent;
                        if (x) {
                            App.redirect(C, {}, x)
                        } else {
                            App.redirect(C)
                        }
                    } else {
                        try {
                            window.parent.postMessage({
                                task: "open_url",
                                open_url: C
                            }, "*")
                        } catch (z) {
                            console.log(z)
                        }
                    }
                } else {
                    App.redirect(C)
                }
            })
        }
        function u() {
            var i = new Swiper("#" + a,{
                loop: true,
                autoplay: {
                    disableOnInteraction: false,
                    delay: 3000,
                },
                pagination: {
                    el: ".swiper-pagination",
                    type: "fraction",
                    renderFraction: function(y, x) {
                        return '<span class="' + y + '"></span>/<span class="' + x + '"></span>'
                    },
                },
            })
        }
        u();
        var j = f.find("img");
        var q = j.length;
        for (var p = 0; p < q; p++) {
            var n = $(j[p]);
            var t = n.attr("data-src");
            if (t.indexOf(".html") != -1 || t.indexOf(".dat") != -1) {
                (function v(i, x) {
                        App.getResourceLocation(h, x, function(y) {
                            i.attr("src", y)
                        })
                    }
                )(n, t)
            } else {
                n.attr("src", t)
            }
        }
    })
}
;
HTML.hSlider = function(l, c, d, a, i) {
    var b = $($("#hslider-box-tmp").html());
    b.find(".type-title").html(c.name);
    b.find(".type-group-icon").addClass(c.icon);
    l.append(b);
    var e = [];
    var g = 0;
    var j = Net.urlSet.refreshBatch;
    var k = {};
    var h = b.find(".swiper-wrapper");
    if (d) {
        b.find(".type-more").on("click", function() {
            App.redirect("type", {
                id: d
            })
        })
    }
    function f() {
        var n = $(".bottom-nav-item.selected").attr("data-type");
        var m = "main";
        k = {
            tableName: c.tableName,
            loadModel: m,
            navigationType: n,
            id: c.id,
            categoryId: c.categoryId,
            dataSourceMode: c.dataSourceMode,
            extend: c.extend,
            pageIndex: 1,
            pageSize: c.resourceNumber
        };
        Net.refreshBatch(n, c.id, c.categoryId, c.dataSourceMode, c.extend, 1, c.resourceNumber, m, c.tableName, function(v) {
            var s = v.data;
            var t = s.length;
            e = e.concat(s);
            for (var r = 0; r < t; r++) {
                var q = s[r];
                var u = $($("#hslider-box-item-tmp").html());
                h.append(u);
                if (a) {
                    a(u, q, j, k, e, g++)
                }
            }
            var p = HTML.generateUniqueId("hslider-box-swiper");
            b.find(".hslider-box-swiper").attr("id", p);
            var o = new Swiper("#" + p,{
                slidesPerView: i == undefined ? 3 : i,
                spaceBetween: 0,
                loop: true,
                pagination: {
                    el: ".swiper-pagination",
                    clickable: true,
                },
            })
        })
    }
    f()
}
;
HTML.boxList = function(b, u, g, f, m, r, d, k, l) {
    var j = [];
    var h = 0;
    var t = {};
    var o = Net.urlSet.refreshBatch;
    var p = $($("#type-box-tmp").html());
    if (!g) {
        p.find(".type-more").remove()
    }
    if (!f) {
        p.find(".type-refresh").remove()
    }
    p.find(".type-refresh").attr("data-page-size", u.resourceNumber);
    p.find(".type-title").html(u.name);
    p.find(".type-group-icon").addClass(u.icon);
    b.append(p);
    var e = p.find(".box-content-list");
    if (k) {
        var c = e.closest(".type-content-wrapper");
        var n = $('<span class="load-more"><span class="load-more-icon"><i class="iconfont icon-jiazai"></i></span><span class="no-more-data">我们是有底线的</span></span>');
        e.parent().append(n);
        var q = new IntersectionObserver(function(v) {
                if (v[0].intersectionRatio <= 0) {
                    return
                }
                if (e.attr("data-load") === "-1") {
                    return
                }
                console.log("Loaded new items");
                var x = c.attr("data-page");
                x = x == undefined ? 2 : parseInt(x);
                c.attr("data-page", x + 1);
                var w = "downLoad";
                Net.refreshBatch(navigationType, u.id, u.categoryId, u.dataSourceMode, u.extend, x, pageSize, w, u.tableName, function(z) {
                    var y = z.data;
                    s(e, y, d)
                })
            }
        );
        q.observe(n[0])
    }
    var i = u.list;
    if (i) {
        pageSize = 9999;
        s(e, i, d)
    } else {}
    if (u.moreDataUI == 1 && f) {
        p.find(".type-refresh").on("click", function() {
            var C = $(this);
            var z = C.attr("data-load-active");
            if (z == "0") {
                hsycms.fail("没有更多数据", function() {}, 1800);
                return
            }
            var B = C.attr("data-page");
            var v = C.attr("data-page-size");
            var y = C.closest(".type-box-item");
            var x = y.find(".box-content-list");
            B = parseInt(B ? B : "1");
            B++;
            var A = $(".bottom-nav-item.selected").attr("data-type");
            var w = "refresh";
            t = {
                tableName: u.tableName,
                loadModel: w,
                navigationType: A,
                id: u.id,
                categoryId: u.categoryId,
                dataSourceMode: u.dataSourceMode,
                pageIndex: B,
                pageSize: v
            };
            Net.refreshBatch(A, u.id, u.categoryId, u.dataSourceMode, u.extend, B, v, w, u.tableName, function(E) {
                var D = E.data;
                if (D.length == 0) {
                    C.attr("data-load-active", "0");
                    hsycms.fail("没有更多数据", function() {}, 1800);
                    return
                }
                C.attr("data-page", B);
                x.html("");
                s(x, D, d)
            })
        })
    } else {
        p.find(".type-box-footer").remove()
    }
    p.find(".type-more").on("click", function() {
        App.redirect("type", {
            id: m
        })
    });
    if (k) {
        p.find(".type-box-footer").remove()
    }
    function s(w, y, B) {
        if (y.length < pageSize || y.length == 0) {
            w.attr("data-load", "-1");
            if (n) {
                n.find(".no-more-data").html("我们是有底线的").show();
                n.find(".load-more-icon").hide()
            }
        }
        j = j.concat(y);
        var z = y.length;
        for (var x = 0; x < z; x++) {
            var v = y[x];
            var A = $($("#box-content-item-tmp").html());
            if (l != undefined && l) {
                A.addClass("box-row")
            }
            if (B && x === 0) {
                A.addClass("top-box")
            }
            w.append(A);
            if (r) {
                r(A, v, B && x === 0, o, t, j, h++)
            }
        }
    }
    function a() {
        navigationType = $(".bottom-nav-item.selected").attr("data-type");
        pageSize = p.find(".type-refresh").attr("data-page-size");
        var v = "main";
        t = {
            tableName: u.tableName,
            loadModel: "main",
            extend: u.extend,
            navigationType: navigationType,
            id: u.id,
            categoryId: u.categoryId,
            dataSourceMode: u.dataSourceMode,
            pageIndex: 1,
            pageSize: pageSize
        };
        Net.refreshBatch(navigationType, u.id, u.categoryId, u.dataSourceMode, u.extend, 1, pageSize, v, u.tableName, function(x) {
            e.css({
                "min-height": "auto"
            });
            var w = x.data;
            s(e, w, d)
        })
    }
    a()
}
;
HTML.boxLoadList = function(o, f, a, h, n, e, b, d, m) {
    var l = o.closest(".load-box-container");
    var i = [];
    var k = 0;
    function j(p, q) {
        o.closest(".swiper-slide.slidepage").attr("data-page", p);
        var s = $(".sort-item.selected").attr("data-sort");
        s = s == undefined ? "" : s;
        var r = {
            navigationType: f,
            id: a,
            categoryId: h,
            dataSourceMode: n,
            pageIndex: p,
            pageSize: q,
            sort: s,
            tagId: e,
            extend: m
        };
        Net.typeDataList(f, a, h, n, s, e, p, q, function(u) {
            var x = u.data;
            var w = x.length;
            if (w == 0 && p == 1) {
                var A = o.closest(".swiper-slide.slidepage");
                A.find(".no-more-data").html("没有找到数据").show();
                A.find(".load-more-icon").hide();
                return
            }
            if (w < q) {
                l.attr("data-load", "1");
                var A = o.closest(".swiper-slide.slidepage");
                A.find(".no-more-data").html("我们是有底线的").show();
                A.find(".load-more-icon").hide()
            } else {
                var A = o.closest(".swiper-slide.slidepage");
                A.find(".load-more-icon").show();
                l.removeAttr("data-load")
            }
            i = i.concat(x);
            for (var v = 0; v < w; v++) {
                var t = x[v];
                var y = $($("#box-content-item-tmp").html());
                y.data("data", t);
                y.attr("data-id", t.id);
                var z = d && v === 0 && o.closest(".swiper-slide.slidepage").attr("data-page") === "1";
                if (z) {
                    y.addClass("top-box")
                }
                o.append(y);
                if (b) {
                    b(y, t, z, Net.urlSet.getList, r, i, k++)
                }
            }
        })
    }
    $(window).on("scroll", function() {
        var q = $(this);
        var p = q.scrollTop();
        if (p > 600) {
            $(".top-group").fadeIn(1000)
        } else {
            $(".top-group").fadeOut(1000)
        }
    });
    var c = new IntersectionObserver(function(p) {
            if (p[p.length - 1].intersectionRatio <= 0) {
                return
            }
            if (l.attr("data-load") === "1") {
                return
            }
            console.log("Loaded new items");
            l.attr("data-load", "1");
            var q = l.attr("data-page");
            q = q == undefined ? 1 : parseInt(q);
            j(q, 30);
            l.attr("data-page", q + 1)
        }
    );
    c.observe(l.find(".load-more")[0]);
    var g = o.closest(".load-box-container").find(".sort-container");
    if (g.length > 0) {
        g.find(".sort-item").on("click", function() {
            var s = $(this);
            g.find(".sort-item").removeClass("selected");
            s.addClass("selected");
            var r = s.attr("data-index");
            var p = g.find(".sort-item").length;
            var q = 100 / p;
            g.find(".selected-block").animate({
                left: parseInt(r) * q + "%"
            }, 300);
            l.attr("data-page", 1);
            l.removeAttr("data-load");
            l.find(".no-more-data").hide();
            l.find(".load-more-icon").show();
            o.css("height", "2000px");
            setTimeout(function() {
                o.css("height", "auto")
            }, 100);
            o.html("")
        })
    }
    $(".top-group").on("click", function() {
        window.scrollTo({
            left: 0,
            top: 0,
            behavior: "smooth"
        })
    })
}
;
HTML.boxAjaxLoadList = function(j, a, i) {
    var h = j.closest(".load-box-container");
    var f = [];
    var e = 0;
    function g(k, l) {
        h.find(".load-more-icon").show();
        h.find(".no-more-data").hide();
        a(k, l, c)
    }
    function c(q) {
        var k = h.attr("data-page");
        var n = q.data;
        var o = n.length;
        if (o == 0 && k == 2) {
            h.find(".load-more-icon").hide();
            h.find(".no-more-data").html("没有找到数据").show();
            return
        }
        if (o < 30) {
            h.find(".load-more-icon").hide();
            h.find(".no-more-data").html("我们是有底线的").show()
        } else {
            h.removeAttr("data-load");
            h.find(".load-more-icon").show();
            h.find(".no-more-data").hide()
        }
        f = f.concat(n);
        for (var m = 0; m < o; m++) {
            var l = n[m];
            var p = $($("#box-content-item-tmp").html());
            p.data("data", l);
            p.attr("data-id", l.id);
            j.append(p);
            if (i) {
                i(p, l, f, e++)
            }
        }
    }
    $(window).on("scroll", function() {
        var l = $(this);
        var k = l.scrollTop();
        if (k > 600) {
            $(".top-group").fadeIn(1000)
        } else {
            $(".top-group").fadeOut(1000)
        }
    });
    var b = new IntersectionObserver(function(k) {
            if (k[0].intersectionRatio <= 0) {
                return
            }
            if (h.attr("data-load") === "1") {
                return
            }
            console.log("Loaded new items");
            h.attr("data-load", "1");
            var l = h.attr("data-page");
            l = l == undefined ? 1 : parseInt(l);
            g(l, 30);
            h.attr("data-page", l + 1)
        }
    );
    b.observe(h.find(".load-more")[0]);
    var d = j.closest(".load-box-container").find(".sort-container");
    if (d.length > 0) {
        d.find(".sort-item").on("click", function() {
            var k = $(this);
            d.find(".sort-item").removeClass("selected");
            k.addClass("selected");
            h.attr("data-page", 1);
            h.removeAttr("data-load");
            h.find(".load-more").html('<span className="load-more-icon"><i className="iconfont icon-jiazai"></i></span>');
            j.css("height", "2000px");
            setTimeout(function() {
                j.css("height", "auto")
            }, 100);
            j.html("")
        })
    }
    $(".top-group").on("click", function() {
        window.scrollTo({
            left: 0,
            top: 0,
            behavior: "smooth"
        })
    })
}
;
HTML.renderNav = function(j, g, d, c) {
    var f = '<div class="bottom-nav-item {selectedClass}">        <div class="data-url" data-href="{url}">            <div class="nav-group">               <i class="{icon}"></i>               <p>{title}</p>           </div>        </div>    </div>';
    var b = g.length;
    for (var e = 0; e < b; e++) {
        var a = g[e];
        h(a)
    }
    h({
        navigationType: 5,
        title: "我的"
    });
    function h(l) {
        var n = l.title;
        var m = l.navigationType;
        l = App.data.mainNavData[m];
        var k = f.replace("{icon}", l.icon);
        k = k.replace("{title}", n);
        k = k.replace("{url}", Net.navUrlMaping[l.navigationType].url);
        if (d == l.navigationType) {
            k = k.replace("{selectedClass}", "selected")
        } else {
            k = k.replace("{selectedClass}", "")
        }
        var i = $(k);
        i.attr("data-type", m);
        i.data("data", l);
        j.append(i);
        i.on("click", function() {
            var p = $(this);
            var o = p.find(".data-url").attr("data-href");
            App.redirect(o)
        })
    }
}
;
HTML.renderResourceList = function(c, h, o, d, l, u, p) {
    var a = undefined;
    var m = '<div class="swiper-slide">    <span>{title}</span></div>';
    var w = '<div class="swiper-slide slidepage">            <div class="swiper-container scroll">                <div class="swiper-wrapper">                    <div class="swiper-slide slidescroll">                        {html}                    </div>                </div>            </div>           </div>';
    var x = h.length;
    var e = c.find(".swiper-wrapper");
    var n = $("#page").find(".swiper-wrapper");
    for (var s = 0; s < x; s++) {
        var j = h[s];
        var b = m.replace("{title}", j.name);
        var q = $(b);
        if (s == 0) {
            q.find("span").css("color", "#E1B90A");
            q.addClass("swiper-slide-selected")
        }
        q.attr("data-ui", j.uiFormat);
        q.attr("data-index", s);
        q.data("data", j);
        e.append(q);
        var g = w.replace("{html}", j.name);
        var t = $(g);
        n.append(t);
        t.attr("data-index", s);
        t.data("data", j);
        t.attr("data-id", j.id);
        t.attr("data-mode", j.dataSourceMode);
        var k = $('<div class="top-group"><span class="top-icon"><i class="ext_iconfont icon-huidingbu"></i></span></div>');
        k.attr("data-id", j.id);
        $("body").append(k);
        (function(i, y) {
                $(window).on("scroll", function() {
                    var B = $(this);
                    var z = $("#page .slidepage.swiper-slide-active").attr("data-id");
                    var A = B.scrollTop();
                    if (A > 600) {
                        $('.top-group[data-id="' + z + '"]').fadeIn(1000).attr("data-show", "1")
                    } else {
                        $('.top-group[data-id="' + z + '"]').fadeOut(1000).removeAttr("data-show")
                    }
                    sessionStorage.setItem(y + "-page-" + z + "-scrollTop", A)
                });
                k.on("click", function() {
                    window.scrollTo({
                        left: 0,
                        top: 0,
                        behavior: "smooth"
                    })
                })
            }
        )(t, p);
        if (s == 0) {
            a = t
        }
    }
    var f = 300;
    var r = new Swiper("#nav",{
        slidesPerView: 6.5,
        freeMode: true,
        on: {
            init: function() {
                navSlideWidth = this.slides.eq(0).css("width");
                bar = this.$el.find(".bar");
                bar.css("width", navSlideWidth);
                bar.transition(f);
                navSum = this.slides[this.slides.length - 1].offsetLeft;
                clientWidth = parseInt(this.$wrapperEl.css("width"));
                navWidth = 0;
                for (s = 0; s < this.slides.length; s++) {
                    navWidth += parseInt(this.slides.eq(s).css("width"))
                }
            },
        },
        slideChangeTransitionStart: function(i) {
            console.log(i)
        }
    });
    var v = new Swiper("#page",{
        watchSlidesProgress: true,
        resistanceRatio: 0,
        on: {
            transitionEnd: function() {
                $("#top .swiper-slide").removeClass("swiper-slide-selected");
                $('#top .swiper-slide[data-index="' + this.activeIndex + '"]').addClass("swiper-slide-selected")
            },
            transitionStart: function() {
                console.log("transitionStart----------------------");
                $("#top .swiper-slide").removeClass("swiper-slide-selected");
                $('#top .swiper-slide[data-index="' + this.activeIndex + '"]').addClass("swiper-slide-selected");
                activeIndex = this.activeIndex;
                activeSlidePosition = r.slides[activeIndex].offsetLeft;
                bar.transition(f);
                bar.transform("translateX(" + activeSlidePosition + "px)");
                r.slides.eq(activeIndex).find("span").transition(f);
                r.slides.eq(activeIndex).find("span").css("color", "#E1B90A");
                if (activeIndex > 0) {
                    r.slides.eq(activeIndex - 1).find("span").transition(f);
                    r.slides.eq(activeIndex - 1).find("span").css("color", "rgba(255,255,255,1)")
                }
                if (activeIndex < this.slides.length) {
                    r.slides.eq(activeIndex + 1).find("span").transition(f);
                    r.slides.eq(activeIndex + 1).find("span").css("color", "rgba(255,255,255,1)")
                }
                navActiveSlideLeft = r.slides[activeIndex].offsetLeft;
                r.setTransition(f);
                if (navActiveSlideLeft < (clientWidth - parseInt(navSlideWidth)) / 2) {
                    r.setTranslate(0)
                } else {
                    if (navActiveSlideLeft > navWidth - (parseInt(navSlideWidth) + clientWidth) / 2) {
                        r.setTranslate(clientWidth - navWidth)
                    } else {
                        r.setTranslate((clientWidth - parseInt(navSlideWidth)) / 2 - navActiveSlideLeft)
                    }
                }
            },
            slideChangeTransitionStart: function(F) {
                var D = $(".slidepage.swiper-slide-active");
                console.log("slideChangeTransitionStart-----------------");
                var z = D.data("data");
                var y = D.attr("data-id");
                var C = D.attr("data-mode");
                var G = $(".bottom-nav-item.selected").data("data").navigationType;
                var E = D.attr("data-index");
                var A = E == 0;
                $(".swiper-slide.slidescroll").hide();
                HTML.renderPage(D, y, G, A, z, d, l, u);
                var B = D.attr("data-id");
                $(".top-group").hide();
                var i = $('.top-group[data-id="' + B + '"]');
                if (i.attr("data-show") == "1") {
                    i.show()
                }
            }
        }
    });
    r.$el.on("touchstart", function(i) {
        i.preventDefault()
    });
    r.on("tap", function(i) {
        clickIndex = this.clickedIndex;
        clickSlide = this.slides.eq(clickIndex);
        v.slideTo(clickIndex, 0);
        this.slides.find("span").css("color", "rgba(255,255,255,1)");
        clickSlide.find("span").css("color", "#E1B90A")
    });
    if (o) {
        o(a)
    }
}
;
HTML.renderPage = function(i, a, n, e, b, k, o, l) {
    i.find(".swiper-slide.slidescroll").show();
    if (i.attr("data-reader") === "1") {
        var f = i.attr("data-id");
        var c = sessionStorage.getItem(n + "-page-" + f + "-scrollTop");
        window.scrollTo({
            left: 0,
            top: c
        });
        return
    }
    window.scrollTo({
        left: 0,
        top: 0
    });
    var m = i.find(".slidescroll");
    m.html("");
    if (e) {
        var d = $('<div class="top-group-container"></div>');
        m.append(d);
        if (Net.navUrlMaping["4"].navigationType != n) {
            HTML.swiper(d, n)
        }
        var j = $($("#fit-nav-tmp").html());
        d.append(j);
        j.find(".fit-tags").on("click", function() {
            App.redirect("tags")
        });
        if (Net.navUrlMaping["4"].navigationType != n) {
            Net.loadQd(n, 1, function(u) {
                var v = u.data;
                var w = d.find(".ad-wrapper");
                var q = v.length;
                if (q == 0) {
                    w.remove()
                }
                var p = w.find(".ad-wrapper-row");
                for (var t = 0; t < q; t++) {
                    var s = v[t];
                    var r = $('<div class="ad-item"> <div class="ad-item-content">     <div class="open-item" href="' + s.url + '"><img src="' + s.cover + '"><span class="qd_name">' + s.name + "</span></div> </div></div>");
                    p.append(r);
                    r.on("click", function() {
                        var A = $(this);
                        var x = A.find(".open-item").attr("href");
                        if (window.self == window.top) {
                            var y = window.parent;
                            if (y) {
                                App.redirect(x, {}, y)
                            } else {
                                App.redirect(x)
                            }
                        } else {
                            try {
                                window.parent.postMessage({
                                    task: "open_url",
                                    open_url: x
                                }, "*")
                            } catch (z) {
                                console.log(z)
                            }
                        }
                    })
                }
            })
        }
        var g = $("#notice-tmp").html();
        m.append(g);
        Net.notifyList(n, function(t) {
            var s = t.data;
            var r = $(".swiper-wrapper .notice-list");
            r.html("");
            for (var q = 0; q < s.length; q++) {
                var p = s[q];
                r.append('<span data-model="' + p.openModel + '" data-url="' + p.url + '">' + (q + 1) + "." + p.htmlContent + "</span>")
            }
            r.find("span").on("click", function() {
                var x = $(this);
                var w = x.attr("data-url");
                var u = x.attr("data-model");
                var v = "_self";
                if (u == 1) {
                    v = "_blank"
                }
                window.open(w, v)
            });
            r.css({
                animation: "10s linear 0s infinite normal none running notice-move"
            })
        })
    }
    if (b.dataSourceMode === "classifyModule") {
        Net.resourceView(a, n, function(s) {
            var u = s.data;
            var r = u.length;
            for (var q = 0; q < r; q++) {
                var p = u[q];
                var t = p.uiFormat;
                var v = p.id;
                if (t == 1) {
                    HTML.hSlider(m, p, v, k, l)
                } else {
                    if (t == 2) {
                        HTML.boxList(m, p, true, true, v, o, false)
                    } else {
                        if (t == 3) {
                            HTML.boxList(m, p, true, true, v, o, true)
                        } else {
                            if (t == 4) {
                                HTML.boxList(m, p, true, true, v, o, false, true)
                            } else {
                                if (t == 5) {
                                    HTML.boxList(m, p, true, true, v, o, false, true, true)
                                } else {
                                    if (t == 6) {
                                        HTML.boxList(m, p, true, true, v, o, false, false, true)
                                    }
                                }
                            }
                        }
                    }
                }
            }
        })
    } else {
        var h = $('<div class="main-load-box-container type-container load-box-container type-content-wrapper"><div class="box-content-list"></div><span class="load-more"><span class="load-more-icon"><i class="iconfont icon-jiazai"></i></span><span class="no-more-data">我们是有底线的</span></span></div>');
        m.append(h);
        HTML.boxLoadList(h.find(".box-content-list"), n, b.id, b.dataId, b.dataSourceMode, "", o, b.uiFormat === 3)
    }
    i.attr("data-reader", "1")
}
;
HTML.openSearchPanel = function(e, j, l) {
    $(".search-history-panel").show();
    $(".search-result-list>.box-content-list").html("");
    $(".search-key").val("");
    var n = "dance_search_data_" + e;
    var g = localStorage.getItem(n);
    $(".search-panel").toggleClass("search-show");
    var d = $(".search-history-list");
    d.html("");
    if (g) {
        g = g.split("|");
        var c = g.length;
        for (var h = 0; h < c; h++) {
            var a = g[h];
            k(a, h)
        }
    }
    function k(o, i) {
        var p = '<li data-type="' + e + '" data-id="' + o + '" class="search-history-item"><span class="item">' + o + "</span></li>";
        if (i % 2 == 1) {
            p = '<span class="segmentation"><span></span></span>' + p
        }
        d.append(p)
    }
    $(".close-search-panel").unbind("click").on("click", function() {
        $(".search-panel").toggleClass("search-show")
    });
    $(".clean-history-list").unbind("click").on("click", function() {
        hsycms.confirm("确定清除搜索历史吗?", function() {
            localStorage.removeItem(n);
            $(".search-history-list").html("")
        })
    });
    $(".remove-item").unbind("click").on("click", function() {
        var s = $(this).closest(".search-history-item");
        s.remove();
        var i = s.attr("data-type");
        var r = s.find(".item").html();
        var t = localStorage.getItem(n);
        if (t) {
            t = t.split("|");
            var p = [];
            for (var o in t) {
                var q = t[o];
                if (q != r) {
                    p.push(q)
                }
            }
            t = p
        } else {
            t = [r]
        }
        localStorage.setItem(n, t.join("|"))
    });
    $(".search-go").unbind("click").on("click", function() {
        var r = $(this);
        var q = r.closest(".search-panel-top").find(".search-key").val();
        if (q == "") {
            hsycms.fail("请输入关键字", function() {}, 1800);
            return
        }
        var s = localStorage.getItem(n);
        if (s) {
            s = s.split("|");
            var o = [];
            for (var i in s) {
                var p = s[i];
                if (p != q) {
                    o.push(p)
                }
            }
            o.unshift(q);
            s = o
        } else {
            s = [q]
        }
        localStorage.setItem(n, s.join("|"));
        Net.searchData(e, q, function(t) {
            if (t.data.data.length == 0) {
                $(".empty-msg").show()
            } else {
                $(".empty-msg").hide()
            }
            l(t)
        });
        d.prepend('<li data-type="' + e + '" data-id="' + q + '" class="search-history-item"><span class="item">' + q + '</span><span class="remove-item"><i class="icon iconfont icon-guanbi" aria-hidden="true"></i></span></li>')
    });
    d.find(".search-history-item").on("click", function() {
        var p = $(this);
        var i = p.attr("data-type");
        var o = p.find(".item").html();
        Net.searchData(e, o, function(q) {
            if (q.data.data.length == 0) {
                $(".empty-msg").show()
            } else {
                $(".empty-msg").hide()
            }
            l(q)
        })
    });
    var b = j.length;
    var m = $(".recommend-list-data");
    m.html("");
    for (var h = 0; h < b; h++) {
        var f = j[h];
        m.append('<span class="recommend-list-item" data-id="' + f.id + '">' + f.title + "</span>")
    }
    m.find(".recommend-list-item").on("click", function() {
        var o = $(this);
        var i = o.attr("data-id");
        App.redirect("info", {
            id: i,
            userId: App.getUser().id
        })
    });
    Net.loadHostTags(e, function(s) {
        var p = s.data;
        var r = p.length;
        var o = $(".host-tags-list-data");
        o.html("");
        for (var q = 0; q < r; q++) {
            var t = p[q];
            o.append('<span class="host-tags-list-item" data-id="' + t.name + '">' + t.name + "</span>")
        }
        o.find(".host-tags-list-item").on("click", function() {
            var i = $(this);
            App.redirect("tag", {
                id: i.attr("data-id")
            })
        })
    })
}
;
HTML.errorMsg = function(e, d) {
    var c = $("body");
    var b = c.find("#error-msg");
    if (b.length == 0) {
        var a = '<div id="html-error-msg"> <span class="msg-title">错误</span> <span class="msg-title">错误</span> <span class="msg-text">' + e + "</span></div>";
        b = $(a)
    } else {
        c.append(b)
    }
    d = d === undefined ? 1000 : d;
    setTimeout(function() {
        b.remove()
    }, d)
}
;
HTML.openPanel = function(b, a) {
    var d = $("body");
    var c = d.find(".window-panel");
    if (c.length == 0) {
        c = $('<div class="window-panel">    <div class="panel-title"></div>    <div class="panel-body">        <iframe class="panel-target" src></iframe>    </div>    <div class="panel-footer">        <span class="close-panel"><i class="iconfont icon-guanbi"></i></span>\n    </div></div>');
        d.append(c)
    }
    c.find(".panel-target").attr("src", b);
    c.find(".close-panel").on("click", function() {
        c.remove();
        if (a) {
            a()
        }
    })
}
;
HTML.fillImage = function(a, b, c) {
    //a : 图片url
    //b : img的jquey实例
    //c : Net.navUrlMaping["1"].navigationType = 1

    // 执行结果就是将b的src属性设置为a
    c = c == undefined ? App.getNavigationType() : c;
    App.getResourceLocation(c, a, function(d) {
        b.attr("src", d)
    })
}
;
HTML.parseHtmlImg = function(a) {
    var b = a.replace(/\+/g, "*");
    b = b.replace(/\//g, "+");
    b = b.replace(/\*/g, "/");
    return b
}
;
HTML.comicsHSideBoxCaller = function(c, b, d) {
    var a = $($("#box-item-tmp").html());
    c = c.find(".box-wrapper");
    c.data("data", b);
    c.attr("data-id", b.id);
    a.find(".box-name").html(b.title);
    a.find(".box-type-txt").html(b.isFinish == 1 ? "完结" : "连载").addClass("box-update-" + b.isFinish);
    HTML.fillImage(b.verticalCover, a.find(".box-content-img"));
    a.find(".box-update").html(b.title);
    a.find(".box-chapter-count>span").html(b.chaptersCount);
    a.find(".box-score>span").html(b.score);
    if (b.mark && b.mark != "") {
        a.find(".font-mark").html(b.mark).attr("style", JSON.parse(App.loadSysConfig()["mark_style"])[b.mark])
    } else {
        a.find(".font-mark").remove()
    }
    c.append(a);
    c.on("click", function() {
        var f = $(this);
        var e = f.attr("data-id");
        App.redirect("info", {
            id: e,
            userId: App.getUser().id
        })
    })
}
;
HTML.comicsBoxCaller = function(d, b) {
    var a = $($("#box-item-tmp").html());
    var c = d;
    d = d.find(".box-wrapper");
    d.data("data", b);
    d.attr("data-id", b.id);
    a.find(".box-name").html(b.title);
    a.find(".box-type-txt").html(b.isFinish == 1 ? "完结" : "连载").addClass("box-update-" + b.isFinish);
    if (c.hasClass("top-box") && b.landscapeCover) {
        HTML.fillImage(b.landscapeCover, a.find(".box-content-img"))
    } else {
        HTML.fillImage(b.verticalCover, a.find(".box-content-img"))
    }
    a.find(".box-update").html(b.title);
    a.find(".box-chapter-count>span").html(b.chaptersCount);
    a.find(".box-score>span").html(b.score);
    if (b.mark && b.mark != "") {
        a.find(".font-mark").html(b.mark).attr("style", JSON.parse(App.loadSysConfig()["mark_style"])[b.mark])
    } else {
        a.find(".font-mark").remove()
    }
    a.find(".box-play").html(b.note);
    d.append(a);
    d.on("click", function() {
        var f = $(this);
        var e = f.attr("data-id");
        App.redirect("info", {
            id: e,
            userId: App.getUser().id
        })
    })
}
;
HTML.novelHSideBoxCaller = function(c, b, d) {
    var a = $($("#box-item-tmp").html());
    c = c.find(".box-wrapper");
    c.data("data", b);
    c.attr("data-id", b.id);
    a.find(".box-name").html(b.title);
    a.find(".box-type-txt").html(b.isFinish == 1 ? "完结" : "连载").addClass("box-update-" + b.isFinish);
    App.getResourceLocation(App.getNavigationType(), b.verticalCover, function(e) {
        a.find(".box-content-img").attr("src", e)
    });
    if (b.mark && b.mark != "") {
        a.find(".font-mark").html(b.mark).attr("style", JSON.parse(App.loadSysConfig()["mark_style"])[b.mark])
    } else {
        a.find(".font-mark").remove()
    }
    a.find(".box-update").html(b.title);
    a.find(".box-chapter-count>span").html(b.chaptersCount);
    a.find(".box-score>span").html(b.score);
    c.append(a);
    c.on("click", function() {
        var f = $(this);
        var e = f.attr("data-id");
        App.redirect("info", {
            id: e,
            userId: App.getUser().id
        })
    })
}
;
HTML.novelBoxCaller = function(c, b, d) {
    var a = $($("#box-item-tmp").html());
    c = c.find(".box-wrapper");
    c.data("data", b);
    c.attr("data-id", b.id);
    a.find(".box-name").html(b.title);
    a.find(".box-type-txt").html(b.isFinish == 1 ? "完结" : "连载").addClass("box-update-" + b.isFinish);
    if (d) {
        App.getResourceLocation(App.getNavigationType(), b.verticalCover, function(e) {
            a.find(".box-content-img").attr("src", e)
        })
    } else {
        App.getResourceLocation(App.getNavigationType(), b.verticalCover, function(e) {
            a.find(".box-content-img").attr("src", e)
        })
    }
    if (b.mark && b.mark != "") {
        a.find(".font-mark").html(b.mark).attr("style", JSON.parse(App.loadSysConfig()["mark_style"])[b.mark])
    } else {
        a.find(".font-mark").remove()
    }
    a.find(".box-update").html(b.title);
    a.find(".box-chapter-count>span").html(b.chaptersCount);
    a.find(".box-score>span").html(b.score);
    a.find(".box-play").html(b.note);
    c.append(a);
    c.on("click", function() {
        var f = $(this);
        var e = f.attr("data-id");
        App.redirect("info", {
            id: e,
            userId: App.getUser().id
        })
    })
}
;
HTML.movieHSideBoxCaller = function(c, b, d) {
    var a = $($("#box-item-tmp").html());
    c = c.find(".box-wrapper");
    c.data("data", b);
    c.attr("data-id", b.id);
    a.find(".box-play-name").html(b.title);
    a.find(".box-play-num").html(App.formatNumber(b.playCount, true));
    App.getResourceLocation(App.getNavigationType(), b.verticalCover, function(e) {
        a.find(".box-content-img").attr("src", e)
    });
    a.find(".box-play-time").html(App.duration(b.duration));
    a.find(".box-update").html(b.title);
    a.find(".box-score>span").html(b.score);
    c.append(a);
    c.on("click", function() {
        var f = $(this);
        var e = f.attr("data-id");
        App.redirect("info", {
            id: e,
            userId: App.getUser().id
        })
    })
}
;
HTML.movieBoxCaller = function(c, b) {
    var a = $($("#box-item-tmp").html());
    c = c.find(".box-wrapper");
    c.data("data", b);
    c.attr("data-id", b.id);
    a.find(".box-play-name").html(b.title);
    a.find(".box-play-num").html(App.formatNumber(b.playCount, true));
    App.getResourceLocation(App.getNavigationType(), b.verticalCover, function(d) {
        a.find(".box-content-img").attr("src", d)
    });
    a.find(".box-play-time").html(App.duration(b.duration));
    a.find(".box-update").html(b.title);
    a.find(".box-score>span").html(b.score);
    a.find(".box-play").html(b.note);
    c.append(a);
    c.on("click", function() {
        var e = $(this);
        var d = e.attr("data-id");
        App.redirect("info", {
            id: d,
            userId: App.getUser().id
        })
    })
}
;
HTML.openRechargeWin = function() {
    $(".recharge-win").show()
}
;
